﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace bll
{
    /// <summary>
    /// clsUser: Klasse für Benutzer von TimeIt
    /// nur Attribute, keine Methoden
    /// </summary>
    public class clsUser
    {
        // private Attribute
        private int _id;
        private string _name;
        private string _position;
        private int _internalHourlyRate;
        private string _loginPw;
        private string _title;
        private static int _session = 0;
        private string _email;

        // Constructor (leer)
        public clsUser() {}

        // properties
        /// <summary>
        /// ID des User
        /// </summary>
        public int ID {
            get { return _id; }
            set { _id = value;}     
            // ID darf eigentlich nicht verändert werden, da der Wert von der DB vergeben wird und nicht verändert werden kann
            // Gridview braucht aus irgendeinem Grund jedoch die set-Methode
        }

        /// <summary>
        /// Name des User
        /// </summary>
        public String Name
        {
            get { return _name; }
            set { if (value != "")
                _name = value;
            else
                _name = "No Name";
            }
        }

        /// <summary>
        /// Anrede vom User
        /// </summary>
        public String Title
        {
            get { return _title; }
            set {_title = value; }
        }

        /// <summary>
        /// Position des User: Mitarbeiter, Projektleiter, Projektmanager, etc. 
        /// </summary>
        public String Position
        {
            get { return _position; }
            set
            {   if (value != "")
                _position = value;
                else
                _position = "No Position";
            }
        }

        /// <summary>
        /// interner Stundensatz (für interne Kostenrechnung)
        /// muss mindestens 1 sein
        /// </summary>
        public int InternalHourlyRate
        {
            get { return _internalHourlyRate; }
            set
            {
                if (value <= 1)
                    _internalHourlyRate = 1;
                else
                    _internalHourlyRate = value;
            }
        }

        /// <summary>
        /// Passwort des User
        /// </summary>
        public String LoginPw
        {
            get { return _loginPw; }
            set
            {
                if (value != "")
                    _loginPw = value;
                else
                    _loginPw = "No password";
            }
        }

        /// <summary>
        /// Email des User
        /// </summary>
        public String Email
        {
            get { return _email; }
            set
            {
                if (value != "")
                    _email = value;
                else
                    _email = "No Mail";
            }
        }

        public static int Session
        {
            get { return _session; }
            set
            {
                    _session = value;
            }
        }
    } // clsUser
}
